package com.example.homework2.controller;
import com.example.homework2.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@Controller
public class IndexController {
    @RequestMapping({ "/toIndex"})
    public String toIndex(Model model, HttpSession session) {
            Student student1 = new Student();
            student1.setName("张博松");
            student1.setPhoneNumber("18*****0055");
            student1.setAddress("东京大学");
            model.addAttribute("student1",student1);
            Student student2 = new Student();
            student2.setName("张博松");
            student2.setPhoneNumber("18*****0055");
            student2.setAddress("郑州大学");
            session.setAttribute("student2",student2);

            return "index";
    }


}
